﻿using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using TouchSocket.Http.WebSockets;
using WebSocketServer.WebSocketService.Message;

namespace WebSocketServer.WebSocketService.MessageHandlers
{
    public class PositionRequestHandler : IMessageHandler
    {
        public bool CanHandle(WebSocketData message)
        {
            throw new NotImplementedException();
        }

        public async Task HandleAsync(IWebSocket socket, WebSocketData message)
        {
            if (message.MessageTopic == EventTopic.CarPosition)
            {
                //TODO: handle position request
                await socket.SendAsync(JsonConvert.SerializeObject( message));

            }
        }
    }
}
